package 滴滴出行;

import java.util.Scanner;

public class 连续子序列最大和 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String[] arrStr = sc.nextLine().split("\\s+");
            int[] a = new int[arrStr.length];
            for (int i = 0; i < arrStr.length; i++) {
                a[i] = Integer.parseInt(arrStr[i]);
            }
            func(a);
        }
        sc.close();
    }

    private static void func(int[] a) {
        int sum = 0;
        int max = Integer.MIN_VALUE;
        for (int x : a) {
            if (sum + x < x)
                sum = x;
            else
                sum += x;
            max = Math.max(max, sum);
        }
        System.out.println(max);
    }
}
